package com.job.GaoYuXuan.Homework0707.Example1;

/**
 * @author 盖
 * @version 1.0
 * @since 2022-07-08 16:29:07
 */
public class Encapsulation {
    private String name;
    private int age;
    private String address;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public String getAddress() {
        return address;
    }

    public void setAge(int age) {
        if(age < 0 || age > 100){
            System.out.println("年龄不符合要求！");
        }
        this.age = age;
    }

    public void setAddress(String address) {
        this.address = address;
    }
}